#ifndef FIELDDRAWER_H
#define FIELDDRAWER_H

#include "src/core/workspace/field.h"
#include <string>
#include <vector>
#include <string>
#include "src/gui/itemwidget.h"
#include "src/core/scene/fieldvisitors.h"

#include <QDebug>

class FieldDrawer
{
public:
  enum draw_type {spheres};
  FieldDrawer(const Field& f, draw_type dt=spheres) : field_(f), draw_type_(dt) {}
  virtual ~FieldDrawer(){}

  void drawAll(ItemWidget* widget)
  {
    FieldVisitor* visitor;
    widget->startList(ItemWidget::Lit);
    switch(draw_type_)
    {
    case spheres: visitor = new SphericalFieldVisitor(widget, ColorMap::defaultBlueToRed()); break;
    default: visitor = new SphericalFieldVisitor(widget, ColorMap::defaultBlueToRed()); break;
    }
    visitor->drawField(field_);
    delete visitor;
    widget->endList();
  }

private:
  const Field& field_;
  draw_type draw_type_;
};

#endif // FIELDDRAWER_H
